<?php
session_start();
header('Content-Type: text/html; charset=iso-8859-1');
require_once($_SESSION['idioma']);
include_once("../../classes/ModulsHoraris.class.php");
?>
<div id="horari_esquerra"><?php echo $idioma['seleccioni_modul']; ?></div>
<div id="horari_dreta">
	<?php
	if ($_GET['any'] != "-1") {
		/* Si l'usuari ha introduit un any valid, busquem
		 * a la bbdd la llista de moduls horaris i la 
		 * mostrem per pantalla. */
		$modulsDAO = new ModulsHoraris();
		$moduls = new ModulsHorarisVO();
		$moduls = $modulsDAO->retornarModulsVO();
		
		echo "<select id='modul' name='modul' onchange=\"enviarPeticio('POST','moduls/horaris/','crearHorarisPerModul.php','horari_capsa','crearHorari'); document.getElementById('horari_capsa').style.display = ''; \">";
		echo "<option value='-1'>-----------</option>";	
		for ($i=0; $i < count($moduls) - 1;$i++) {
			echo "<option value='".$moduls[$i]->id_modul."'>".substr($moduls[$i]->entrada,0,5)." - ".substr($moduls[$i]->sortida,0,5)."</option>";
		}
	} else {
		echo "<select id='modul' name='modul' onchange=\"actualitzarEstatComboModuls();\" disabled=\"disabled\">";
		echo "<option value='-1'>-----------</option></select>";	
	}
?>	
</select></div>